Telegram Group & Telegram Channel
Если ты хочешь запустить код с изменённой глобальной переменной, лучше использовать контекстный менеджер, а не менять её напрямую:


from contextlib import contextmanager

QUIT_MESSAGE = 'Bye'

def print_quit_mesage():
global QUIT_MESSAGE
print(QUIT_MESSAGE)

@contextmanager
def global_variable_changed(name, value):
orig_value = globals()[name]
globals()[name] = value
yield
globals()[name] = orig_value

with global_variable_changed(
'QUIT_MESSAGE',
'Tschüss'
):
print_quit_mesage()


👉@BookPython



tg-me.com/BookPython/3712
Create:
Last Update:

Если ты хочешь запустить код с изменённой глобальной переменной, лучше использовать контекстный менеджер, а не менять её напрямую:


from contextlib import contextmanager

QUIT_MESSAGE = 'Bye'

def print_quit_mesage():
global QUIT_MESSAGE
print(QUIT_MESSAGE)

@contextmanager
def global_variable_changed(name, value):
orig_value = globals()[name]
globals()[name] = value
yield
globals()[name] = orig_value

with global_variable_changed(
'QUIT_MESSAGE',
'Tschüss'
):
print_quit_mesage()


👉@BookPython

BY Библиотека Python разработчика | Книги по питону


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/BookPython/3712

View MORE
Open in Telegram


Библиотека Python разработчика Telegram | DID YOU KNOW?

Date: |

If riding a bucking bronco is your idea of fun, you’re going to love what the stock market has in store. Consider this past week’s ride a preview.The week’s action didn’t look like much, if you didn’t know better. The Dow Jones Industrial Average rose 213.12 points or 0.6%, while the S&P 500 advanced 0.5%, and the Nasdaq Composite ended little changed.

Find Channels On Telegram?

Telegram is an aspiring new messaging app that’s taking the world by storm. The app is free, fast, and claims to be one of the safest messengers around. It allows people to connect easily, without any boundaries.You can use channels on Telegram, which are similar to Facebook pages. If you’re wondering how to find channels on Telegram, you’re in the right place. Keep reading and you’ll find out how. Also, you’ll learn more about channels, creating channels yourself, and the difference between private and public Telegram channels.

Библиотека Python разработчика from id


Telegram Библиотека Python разработчика | Книги по питону
FROM USA